dojo.provide("xray.tools.RecordingStats");

dojo.require("dijit._Templated");
dojo.require("dijit._Widget");

dojo.declare("xray.tools.RecordingStats", 
	[dijit._Widget, dijit._Templated], {
	
	templatePath: dojo.moduleUrl("xray.tools.templates", "RecordingStats.html"),
	events: [],
	
	postCreate:function(){
		dojo.subscribe("xray/tools/recordingstats/event", this, "addEvent");
	},
	
	addEvent: function(data){
		if (data.length > 2){
			console.log("Only key value pairs allowed in RecordingStats.js");
			return;
		}
		this.events.push(data);
		
		var tableR = dojo.doc.createElement("tr");
		var tableD;
		for (i in data){
			tableD = dojo.doc.createElement("td");
			dojo.addClass(tableD, "entry");
			tableD.innerHTML = data[i];
			tableR.appendChild(tableD);
		}
		this.recordingEvents.appendChild(tableR);
	}
});